package com.gopay.cron.service.cloud.gen.bean;

import com.gopay.cron.web.vo.CloudAccountStatementVO;
import com.gopay.cron.web.vo.CloudSplitFileVO;

/** 
 * @ClassName: CloudSplitFileInfo 
 * @Description: 分账类
 * @author liuxuyang
 * @date 2018年3月15日 下午6:43:54  
 */

public class CloudSplitFileInfo {

	public static final String fileFtpName = "分账类";
	
	private static final String csvFtpFirstLine = "\"商户账户\",\"收款总笔数\",\"收款总金额\",\"收款总手续费\"";
    private static final String csvFtpSecondLine = "\"商户编号\",\"分账方协议号\",\"分账订单号\",\"分账金额\",\"支付订单号\",\"交易金额\",\"分账交易时间\",\"分账完成时间\"";

    private StringBuilder csvFtpFirstLineContent = new StringBuilder();
	private StringBuilder csvFtpSecondLineContent = new StringBuilder();
	
	
	public void addFtpFirstSplitFileLine(CloudAccountStatementVO vo) {
        addFtpFirstCsvFileLine(vo);
    }

    private void addFtpFirstCsvFileLine(CloudAccountStatementVO vo) {
        csvFtpFirstLineContent.append("\"").append(vo.getGopayAcct()).append("\",")
                .append("\"").append(vo.getTotalCount()).append("\",")
                .append("\"").append(vo.getTotalTxnAmt()).append("\",")
                .append("\"").append(vo.getTotalFeeAmt()).append("\"")
                .append("\r\n");
    }
    
	public void addFtpSecondSplitFileLine(CloudSplitFileVO vo) {
        addFtpSecondCsvFileLine(vo);
    }

    private void addFtpSecondCsvFileLine(CloudSplitFileVO vo) {
        csvFtpSecondLineContent.append("\"").append(vo.getMerCustId()).append("\",")
                .append("\"").append(vo.getSplitAcctId()).append("\",")
                .append("\"").append(vo.getSplitOrderId()).append("\",")
                .append("\"").append(vo.getSplitOrderAmt()).append("\",")
                .append("\"").append(vo.getOriMerOrderId()).append("\",")
                .append("\"").append(vo.getOriOrderAmt()).append("\",")
                .append("\"").append(vo.getSplitCreateTime()).append("\",")
                .append("\"").append(vo.getSplitFinishTime()).append("\",")
                .append("\r\n");
    }
    
    public String getFtpCsvContent() {
        StringBuilder sb = new StringBuilder(csvFtpFirstLine);
        sb.append("\r\n").append(csvFtpFirstLineContent.toString());
        sb.append(csvFtpSecondLine);
        sb.append("\r\n").append(csvFtpSecondLineContent.toString());
        return sb.toString();
    }
}
